<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item :to="{ path: '/logList' }">日志列表</el-breadcrumb-item>
      <el-breadcrumb-item>日志详情</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card>
      <el-form ref="form" :model="logInfo" label-width="80px">
        <el-row :gutter="20">

          <el-col :span="8">
            <el-form-item label="类型">
              <el-input :disabled="true" v-model="logInfo.logType" size="mini" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="操作人">
              <el-input :disabled="true" v-model="logInfo.operatorName" size="mini" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="ip">
              <el-input :disabled="true" v-model="logInfo.ip" size="mini" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="操作时间">
              <el-input :disabled="true" v-model="logInfo.createtime" size="mini" placeholder="请输入内容"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="日志详情">
              <el-input
                  type="textarea"
                  :rows="2"
                  placeholder="请输入内容"
                  size="mini"
                  :autosize="{ minRows: 6, maxRows: 12}"
                  :disabled="true"
                  v-model="logInfo.logContent">
              </el-input>

            </el-form-item>
          </el-col>

        </el-row>
      </el-form>
      <div  style="text-align: center">   <el-button round size="mini" @click="returnToTheSuperior">返回列表</el-button></div>
    </el-card>

  </div>
</template>

<script>
import {
  getByLogId
} from '../../api/LogApi'

export default {
  name: "logDetail",
  data() {
    return {
      logInfo: {}
    }
  },
  created() {
    this.getById()
  },
  methods: {
    getById() {
      getByLogId(this.$route.query.logId).then(res => {
        let item = ["添加", "编辑", "删除", "导入", "导出", "用户角色变更", "角色权限变更", "异常", "登录"]
        this.logInfo = res.data.info
        // console.log(res)
        if (res.data.info.logType) {
          this.logInfo.logType = item[res.data.info.logType - 1]
        }
      })
    },
    returnToTheSuperior(){
      this.$router.push({path:'/logList'})
    }
  }
}
</script>

<style scoped>

</style>
